<template>
  <div class="box">
    <van-swipe
      class="my-swipe"
      :autoplay="1000"
      :loop="false"
      :show-indicators="false"
    >
      <van-swipe-item>
        <img src="@/assets/images/guide_1.png" alt="">
      </van-swipe-item>
      <van-swipe-item>
        <img src="@/assets/images/guide_2.png" alt="">
      </van-swipe-item>
    </van-swipe>
    <div class="guide_time" @click="goHome">
      <span>跳过 </span>
      <van-count-down :time="time" format="ss" />
      <span>s</span>
    </div>
  </div>
</template>

<script>
import Vue from 'vue'
import { Swipe, SwipeItem, CountDown } from 'vant'
Vue.use(Swipe)
Vue.use(SwipeItem)
Vue.use(CountDown)
export default {
  data () {
    return {
      time: 3000,
      timer: ''
    }
  },
  mounted () {
    this.getTimer()
  },
  methods: {
    goHome () {
      this.$router.replace('/home')
      clearTimeout(this.timer)
    },
    getTimer () {
      this.timer = setTimeout(() => {
        this.$router.replace('/home')
      }, 2000)
    }
  }
}
</script>

<style lang="scss" scoped>
.van-swipe-item {
  width: 100%;
  height: 100%;
  img {
    width: 100%;
  }
}
.guide_time {
  position: absolute;
  top: 0.2rem;
  right: 0.1rem;
  width: 0.65rem;
  height: 0.2rem;
  background: white;
  font-size: 0.16rem;
  line-height: 0.2rem;
  color: #909090;
  .van-count-down {
    display: inline-block;
    font-size: 0.16rem;
    line-height: 0.2rem;
    color: #909090;
  }
}
/* .guide_experience {
  width: 1.38rem;
  height: 0.4rem;
  position: absolute;
  bottom: 0.4rem;
  left: 0;
  right: 0;
  margin: 0 auto;
  border-radius: 0.2rem;
  background-color: chartreuse;
} */
</style>
